﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExtAspNet;

namespace HY.WEB.PQ
{
    public partial class ht_pq_view : PageBase
    {
        public string whe = "", path = "", tab = "pq_ht";
        public string us, um, ubh;          
        protected void Page_Load(object sender, EventArgs e)
        {
            us = Session["ID"].ToString();
            um = Session["user"].ToString();
            ubh = Session["bh"].ToString();

    
            if (!IsPostBack)
            {
                if (!String.IsNullOrEmpty(Request["sid"]))
                {
                     hidsid.Text = Request["sid"].Trim();                
                }
              
                fill2();
            }

        
        }

     

        void fill2()
        {
            string dts; DateTime lastday;

            BLL.PQ.pq_ht S = new BLL.PQ.pq_ht();
            DataTable d=  S.GetList("sid="+hidsid.Text).Tables[0];


            hidsbh.Text = d.Rows[0]["htbh"].ToString().Trim();
            txtht.Text = d.Rows[0]["htbh"].ToString().Trim();

            txtzsales.Text = d.Rows[0]["zsales"].ToString().Trim();

            ddlperson.Text = d.Rows[0]["pname"].ToString().Trim();
            ddlcompany.Text = d.Rows[0]["pvendor"].ToString().Trim();
            lblowen.Text = d.Rows[0]["owen"].ToString().Trim();
            
            string ft=d.Rows[0]["ftype"].ToString().Trim();

            if (ft == "企业")
            {
                ddlcomp.Text = d.Rows[0]["ftype"].ToString() + "-" + d.Rows[0]["fname"].ToString();
                ddlsales.Visible = false;
                ddlschool.Visible = false;
                ddlzj.Visible = false;
            }

            if (ft == "业务员")
            {
                ddlsales.Text = d.Rows[0]["ftype"].ToString() + "-" + d.Rows[0]["fname"].ToString();
                ddlcomp.Visible = false;
                ddlschool.Visible = false;
                ddlzj.Visible = false;
            }


            if (ft == "学校")
            {
                ddlschool.Text = d.Rows[0]["ftype"].ToString() + "-" + d.Rows[0]["fname"].ToString();
                ddlcomp.Visible = false;
                ddlsales.Visible = false;
                ddlzj.Visible = false;
            }

            if (ft == "中介")
            {
                ddlzj.Text = d.Rows[0]["ftype"].ToString() + "-" + d.Rows[0]["fname"].ToString();
                ddlcomp.Visible = false;
                ddlschool.Visible = false;
                ddlsales.Visible = false;
            }

               

            dts = d.Rows[0]["sdate"].ToString().Trim();
            if (dts.Substring(0, 4) != "1900")
            {
                lastday = DateTime.Parse(dts);
                date1.Text = lastday.ToString("yyyy-M-d");
            }

            dts = d.Rows[0]["edate"].ToString().Trim();
            if (dts.Substring(0, 4) != "1900")
            {
                lastday = DateTime.Parse(dts);
                date2.Text = lastday.ToString("yyyy-M-d");
            }


            txtmoney.Text = d.Rows[0]["money"].ToString();
            txtworktype.Text = d.Rows[0]["work"].ToString().Trim();
            txtmemo.Text = d.Rows[0]["memo"].ToString().Trim();

               

        }
  
   
       
       
    }
}